using System;

namespace AsyncLibrary.StatusListener
{
  /// <summary>This interface should be implemented by control which may be used
  ///   as listenter of <see cref="IAsyncOperation"/> status</summary>
  public interface IStatusListener
  {
    /// <summary>Set progress of current operation</summary>
    void SetProgress(int value);
    /// <summary>Set max progress value</summary>
    void SetProgresMax(int value);
    /// <summary>Set progress mode</summary>
    void SetMode(StatusProgressMode value);
    /// <summary>Set main status message</summary>
    /// <remarks>Usually current action is sent here</remarks>
    void SetStatus(string message);
    /// <summary>Set additional information</summary>
    /// <remarks>Usually current action details, 
    ///   like percents or bytes count</remarks>
    void SetInfo(string text);
    /// <summary>Reports about fatal error. 
    ///   Operation is going to close immediately.</summary>
    /// <param name="ex">fata error reason</param>
    void FatalError(Exception ex);
  }

  public class StatusListenerBase : IStatusListener
  {
    public virtual void SetProgress(int value) { }
    public virtual void SetProgresMax(int value) { }
    public virtual void SetMode(StatusProgressMode value) { }
    public virtual void SetStatus(string message) { }
    public virtual void SetInfo(string text) { }
    public virtual void FatalError(Exception ex) { }
  }

}